<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>借用父构造函数继承属性</title>
</head>

<body>
  <script>
    // 借用父构造函数继承属性
    function Father(uname, age) {
      // this指向父构造函数的实例对象
      this.uname = uname;
      this.age = age;
    }
    function Son(uname, age, score) {
      // this指向子构造函数的实例对象
      Father.call(this, uname, age) //调用父构造函数把this指向改为Son的实例对象
      this.score = score;
    }
    var xm = new Son('小明', 12, 90)
    console.log(xm);
  </script>
</body>

</html>